package com.ruoyi.web.controller.trace;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.trace.domain.BusTraceFirmfinger;
import com.ruoyi.trace.service.IBusTraceFirmfingerService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 溯源仪-企业指纹库Controller
 * 
 * @author ruoyi
 * @date 2025-09-26
 */
@RestController
@RequestMapping("/trace/tracefirmfinger")
public class BusTraceFirmfingerController extends BaseController
{
    @Autowired
    private IBusTraceFirmfingerService busTraceFirmfingerService;

    /**
     * 查询溯源仪-企业指纹库列表
     */
    //@PreAuthorize("@ss.hasPermi('trace:tracefirmfinger:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusTraceFirmfinger busTraceFirmfinger)
    {
        startPage();
        List<BusTraceFirmfinger> list = busTraceFirmfingerService.selectBusTraceFirmfingerList(busTraceFirmfinger);
        return getDataTable(list);
    }

    /**
     * 导出溯源仪-企业指纹库列表
     */
    //@PreAuthorize("@ss.hasPermi('trace:tracefirmfinger:export')")
    @Log(title = "溯源仪-企业指纹库", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BusTraceFirmfinger busTraceFirmfinger)
    {
        List<BusTraceFirmfinger> list = busTraceFirmfingerService.selectBusTraceFirmfingerList(busTraceFirmfinger);
        ExcelUtil<BusTraceFirmfinger> util = new ExcelUtil<BusTraceFirmfinger>(BusTraceFirmfinger.class);
        util.exportExcel(response, list, "溯源仪-企业指纹库数据");
    }

    /**
     * 获取溯源仪-企业指纹库详细信息
     */
    //@PreAuthorize("@ss.hasPermi('trace:tracefirmfinger:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(busTraceFirmfingerService.selectBusTraceFirmfingerById(id));
    }

    /**
     * 新增溯源仪-企业指纹库
     */
    //@PreAuthorize("@ss.hasPermi('trace:tracefirmfinger:add')")
    @Log(title = "溯源仪-企业指纹库", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BusTraceFirmfinger busTraceFirmfinger)
    {
        return toAjax(busTraceFirmfingerService.insertBusTraceFirmfinger(busTraceFirmfinger));
    }

    /**
     * 修改溯源仪-企业指纹库
     */
    //@PreAuthorize("@ss.hasPermi('trace:tracefirmfinger:edit')")
    @Log(title = "溯源仪-企业指纹库", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody BusTraceFirmfinger busTraceFirmfinger)
    {
        return toAjax(busTraceFirmfingerService.updateBusTraceFirmfinger(busTraceFirmfinger));
    }

    /**
     * 删除溯源仪-企业指纹库
     */
    //@PreAuthorize("@ss.hasPermi('trace:tracefirmfinger:remove')")
    @Log(title = "溯源仪-企业指纹库", businessType = BusinessType.DELETE)
	@PostMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(busTraceFirmfingerService.deleteBusTraceFirmfingerByIds(ids));
    }
}
